home *** CD-ROM | disk | FTP | other *** search
/ PC Media 3 / PC MEDIA CD03.iso / share / uwin / finst11b / flib.h next >
Encoding:
C/C++ Source or Header  |  1994-04-24  |  6.8 KB  |  169 lines

  1. #ifndef __FLIB_H
  2. #define __FLIB_H
  3.  
  4. #ifndef __STDLIB_H
  5. #include "stdlib.h"
  6. #endif
  7. #ifndef __STRING_H
  8. #include "string.h"
  9. #endif
  10. #ifndef __WINDOWS_H
  11. #include "windows.h"
  12. #endif
  13.  
  14. class dstring                                                /* dynamic string */
  15. {
  16.    int l;                                                            /* length */
  17.    char *p;                                                          /* asciiz */
  18.  
  19.    public:
  20.    dstring();
  21.    dstring(int *r, char s[]);
  22.   ~dstring();
  23.  
  24.    int set(dstring &s)     { return set(s.p);       }
  25.    int getlen()            { return l;              }
  26.    int append(dstring &s)  { return append(s.p);    }
  27.    int compare(char s[])   { return strcmp(p, s);   }
  28.    int compare(dstring &s) { return strcmp(p, s.p); }
  29.    char &operator[](int i) { return p[i];           }
  30.    char *operator+(int i)  { return p+i;            }
  31.    char *getbuf()          { return p;              }
  32.  
  33.    int set(int n);
  34.    int set(char s[]);
  35.    int append(char s[]);
  36.    void putbuf(char s[]);
  37.    char *takbuf();
  38. };
  39.  
  40. class dlgprog                                               /* progress dialog */
  41. {
  42.    int percent;                                          /* current percentage */
  43.    int *flag;         /* point to the abort flag. set it when abort is pressed */
  44.    HWND dlg;                                       /* handle to the dialog box */
  45.    HWND owner;                                      /* owner of the dialog box */
  46.    FARPROC p;                                            /* procedure instance */
  47.    COLORREF metercolor;                           /* color of the progress bar */
  48.  
  49.    public:
  50.    dlgprog(int *r, HINSTANCE inst, HWND owner, int *flag, COLORREF metercolor);
  51.   ~dlgprog();
  52.  
  53.    int chkdlgmsg(MSG FAR *msg)       { return IsDialogMessage(dlg, msg); }
  54.    HWND getdlg()                     { return dlg;                       } 
  55.    void cancel()                     { *flag = 1;                        }
  56.    void settitle(char title[])       { SetWindowText(dlg, title);        }
  57.  
  58.    int peekdispatchmsg();
  59.    void settxt1(char txt[]);
  60.    void settxt2(char txt[]);
  61.    void settxt3(char txt[]);
  62.    void show(int iscenter);
  63.    void setpercent(int p);
  64.    void drawmeter(DRAWITEMSTRUCT FAR *q);
  65. };
  66.  
  67. struct binding                                           /* binding of a macro */
  68. {
  69.    dstring n;                                                    /* macro name */
  70.    dstring v;                                                   /* macro value */
  71. };
  72.  
  73. struct version                                       /* version info of a file */
  74. {
  75.    UINT lang;                                                   /* language id */
  76.    UINT cset;                                                 /* character set */
  77.    DWORD os;                                                             /* os */
  78.    DWORD prmtype;                              /* primary type (exe, dll, etc) */
  79.    DWORD subtype;                         /* sub type (display, keyboard, etc) */
  80.    DWORD verhi32;                                     /* high 32bit version no */
  81.    DWORD verlo32;                                      /* low 32bit version no */
  82. };
  83.  
  84. class pmconv;
  85.  
  86. class simpledde;
  87.  
  88. class installer                        /* name space for installation routines */
  89. {
  90.    public:
  91.    installer();                                           /* set bufs to empty */
  92.   ~installer();                                                    /* del bufs */
  93.  
  94.    int init(HINSTANCE inst, HWND owner, char inffile[]);
  95.  
  96.    int nomacros;                             /* no of macros currently defined */
  97.    int issupressmsg;                /* should fatal or error msg be supressed? */
  98.    char inffile[_MAX_PATH];                                /* path of inf file */
  99.    HWND owner;                                             /* owner of dialogs */
  100.    HINSTANCE inst;
  101.    pmconv *c;                             /* conversation with program manager */
  102.    binding *macros;                                                  /* macros */
  103.    simpledde *d;                                                /* dde wrapper */
  104.  
  105.    int copy(char srcpath[], char dstpath[], int ischeck, int iscompressed);
  106.    int deldir(char dir[]);
  107.    int delfile(char dir[], char file[]);
  108.    int askdir(char dir[], char prompt[]);
  109.    int askquitinstall();
  110.    int askquitllatsni();
  111.    int askretry(char msg[]);
  112.    int askdrive(int *driveno, char prompt[]);
  113.    int askinsertdisk(char diskdesc[]);
  114.    int askoverwrite(char srcpath[], version &srcv, char dstpath[], version &dstv);
  115.    int getpaths(char diskdesc[], char srcfile[], char srcpath[], char dstdir[], char dstfile[], char dstpath[]);
  116.    int readmacroname(char s[], int *n, char r[]);
  117.    int readmacroname(char s[], int *n, char file[], char sect[], char item[]);
  118.    int msgbox(char txt[], char title[], UINT flags);
  119.    int begddepm();
  120.    int getversion(char path[], version *v);
  121.    int delgrup(char grup[]);
  122.    int delitem(char grup[], char item[]);
  123.    int createitem(char grup[], char item[], char cmdl[], char icon[]);
  124.    int getfreespace(int drive, double *f);
  125.    int chkfreespace(int drive, double minf);
  126.    int compareversion(char srcpath[], char dstpath[]);
  127.    int evalmacro(char s[], int *n, char r[], int *m);
  128.    int readfields(char s[], char specifiers[], ...);
  129.    int evalstring(char s[], char r[]);
  130.    int evalstring(char s[], int *n, char r[], int *m);
  131.    int getgmacro(char gn[], char v[]);
  132.    int getemacro(char file[], char sect[], char item[], char v[]);
  133.    int getimacro(char n[], char v[]);
  134.    int setgmacro(char gn[], char v[]);
  135.    int setemacro(char file[], char sect[], char item[], char v[]);
  136.    int setimacro(char n[], char v[]);
  137.    int getnoentries(char sect[], char inifile[] = 0);
  138.    void endddepm();
  139.    void mergedirfile(char path[], char dir[], char file[]);
  140.    void outofmem();
  141.    void fatal(char msg[]);
  142.    void error(char msg[]);
  143.    void errorbadpath(char path[]);
  144.    void fataldel(char path[]);
  145.    void fatalren(char oldpath[], char newpath[]);
  146.    void fatalread(char path[]);
  147.    void fatalcopy(char srcpath[], char dstpath[]);
  148.    void fatalwrite(char path[]);
  149.    void fatalshare(char path[]);
  150.    void fatalcreate(char path[]);
  151.    void fatalaccess(char path[]);
  152.    void fatalnofile(char path[]);
  153.    void fatalsyntax(char s[]);
  154.    void fataldelitem(char name[]);
  155.    void fataldelgrup(char name[]);
  156.    void fatalshowgrup(char name[]);
  157.    void fatalfileinuse(char path[]);
  158.    void fatalundefmacro(char name[]);
  159.    void fatalcreateitem(char name[]);
  160.    void fatalcreategrup(char name[]);
  161.    void fatalreadverinfo();
  162.    void changingcolor(HDC dc, RECT r1, RECT r2, COLORREF cs[], int blkw, int blkh);
  163.    char *getimacro(char n[]);
  164.    char *getentries(char sect[], char inifile[] = 0);
  165.    binding *lookup(char n[]);
  166. };
  167.  
  168. #endif
  169.